import jsonschema
# 导包
dic1={"name":"zhangsan","age":18,"sex":True,"hobby":["吃饭","睡觉","打豆豆"]}
# 待校验的数据

schema={
    "type":"object",
    "properties":{
        "name":{"type":"string"},
        "age":{"type":"integer"},
        "sex":{"type":"boolean"},
        "habby":{"type":"array"}
    },
    "required":["name","age","sex"],
    "name":{"con"}
}
# 定义规则
res=jsonschema.validate(instance=dic1,schema=schema)

# 校验
print(res)